<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/resources/js/jquery-1.11.1.min.js"></script>
    <script src="/resources/js/self.js"></script>
    <script type="text/javascript" src="/resources/js/md5.js"></script>
    <script type="text/javascript" src="/resources/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="/resources/js/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/resources/js/Util.js"></script>
    <script src="/resources/js/fk.js"></script>
    <link href="/resources/video/css/video-js.css" rel="stylesheet">
    <link href="/resources/css/fk_ymm.css?r=2" rel="stylesheet">
    <style>
        td{
            white-space:normal;
        }
        input{
            width: 150px;
        }
        textarea{
           width: 720px;
        }
    </style>
</head>
<body>
   <input type="hidden" class="form-data" name="id"/>
   <input type="hidden" class="form-data" name="policeCheckId">
   <div class="table-title">剧毒化学品从业单位安全检查记录表</div>
   <div>
       <table >
            <tr>
                <td colspan="3" style="padding: 0px !important;">
                    <div class="name"  style="padding-left: 10px;height: 100%;width:30%;float:left">被检查单位</div>
                    <div class="value"  style="padding-left: 10px;width:70%;float:left">
                        <input class="form-data" name="companyName" width="300" />
                    </div>
                </td>
                <td colspan="2" style="padding: 0px !important;">
                    <div class="name" style="padding-left: 10px;height: 100%;width:30%;float:left">
                        物品名称
                    </div>
                    <div class="value" style="padding-left: 10px;width:70%;float:left">
                        <input  class="form-data" name="productName"   width="300"/>
                    </div>
                </td>


            </tr>
            <tr>
                <td class="name"></td>
                <td class="name" width="300">治安防范检查项目</td>
                <td class="name">是否符合标准</td>
                <td class="name" width="300">治安防范检查项目</td>
                <td class="name">是否符合标准</td>
            </tr>
           <tr>
               <td class="name" rowspan="5">保卫组织和管理制度</td>
               <td class="name">建立健全治安保卫机构</td>
               <td class="value"><input class="form-data" name="securityOrg"  /></td>
               <td class="name">配备合格的专职治安保卫人员</td>
               <td class="value"><input class="form-data" name="securityMan"/></td>
           </tr>
           <tr>
               <td class="name">接触剧毒化学品人员登记台帐</td>
               <td class="value"><input class="form-data" name="peopleTouchRecord" /></td>
               <td class="name">剧毒化学品管理统一登记台账</td>
               <td class="value"><input class="form-data" name="manageRecord" /></td>
           </tr>
           <tr>
               <td class="name">储存场所实行24小时专人值守(每两个小时巡查一次并登记） </td>
               <td class="value"><input class="form-data" name="manDutyRecord" /></td>
               <td class="name">“双人管、双把锁、双人收发、双人领退、双方签字”等管理制度</td>
               <td class="value"><input class="form-data" name="manageRule" /></td>
           </tr>
           <tr>
               <td class="name">剧毒化学品事故应急救援预案 </td>
               <td class="value"><input class="form-data" name="emergencyPlan" /></td>
               <td class="name">剧毒化学品案件事故的报告制度</td>
               <td class="value"><input class="form-data" name="accidentRecord" /></td>
           </tr>
           <tr>
               <td class="name">从业人员上岗资格证明 </td>
               <td class="value"><input class="form-data" name="manProof" /></td>
               <td class="name">管理制度和管理人员名单的公示</td>
               <td class="value"><input class="form-data" name="ruleManShow" /></td>
           </tr>
           <tr>
               <td class="name" rowspan="6">基本设施 </td>
               <td class="name">剧毒化学品警示标志 </td>
               <td class="value"><input class="form-data" name="hasLogo" /></td>
               <td class="name">报警电话等通讯设施完备、畅通</td>
               <td class="value"><input class="form-data" name="alarm" /></td>
           </tr>
           <tr>
               <td class="name">符合安全要求的防盗门（双锁） </td>
               <td class="value"><input class="form-data" name="doorLock" /></td>
               <td class="name">符合安全要求的防盗窗</td>
               <td class="value"><input class="form-data" name="windowLock" /></td>
           </tr>
           <tr>
               <td class="name">储存场所安装红外等入侵报警系统并与“110”联网 </td>
               <td class="value"><input class="form-data" name="intrusionAlarm" /></td>
               <td class="name">剧毒化学品储存场所安装视频监控系统</td>
               <td class="value"><input class="form-data" name="storeVideo" /></td>
           </tr>
           <tr>
               <td class="name">剧毒化学品储存场所进出通道、库房出入口安装视频监控系统 </td>
               <td class="value"><input class="form-data" name="trafficVideo" /></td>
               <td class="name">剧毒化学品生产、使用（投料、加注区域）场所安装视频监控系统</td>
               <td class="value"><input class="form-data" name="cVideo" /></td>
           </tr>
           <tr>
               <td class="name">专用储存场所内单独存放 </td>
               <td class="value"><input class="form-data" name="storeAlone" /></td>
               <td class="name">储存场所安装周界入侵报警系统</td>
               <td class="value"><input class="form-data" name="storeAlarm" /></td>
           </tr>
           <tr>
               <td class="name">消防、急救的安全器材和设施 </td>
               <td class="value"><input class="form-data" name="fireDevice" /></td>
               <td class="name">储存场所周边加装电子巡更系统</td>
               <td class="value"><input class="form-data" name="elecPatrol" /></td>
           </tr>
           <tr>
               <td  class="name" rowspan="6">各类专项要求</td>
               <td class="name" colspan="2">氯化物、丙烯醇等桶、袋包装类 </td>
               <td class="name" colspan="2">氯、氟等压缩气体类</td>
           </tr>
           <tr>
               <td class="name">符合国家安全标准的防盗门 </td>
               <td class="value"><input class="form-data" name="securityDoor" /></td>
               <td class="name" >坚固、通风、适温</td>
               <td class="value"><input class="form-data" name="sturdy" /></td>
           </tr>
           <tr>
               <td class="name">坚固、通风、防潮、防渗漏</td>
               <td class="value"><input class="form-data" name="leakProof" /></td>
               <td class="name">安装有毒气体泄露报警装置</td>
               <td class="value"><input class="form-data" name="leakAlarm" /></td>
           </tr>
           <tr>
               <td class="name"  colspan="2">试剂小包装类 </td>
               <td class="name"  colspan="2">大型槽罐类</td>
           </tr>
           <tr>
               <td class="name">坚固、通风、防潮、防渗漏</td>
               <td class="value"><input class="form-data" name="lLeakProof" /></td>
               <td class="name">安装有毒气体泄露报警装置</td>
               <td class="value"><input class="form-data" name="bleakAlarm" /></td>
           </tr>
           <tr>
               <td class="name">防盗保险柜（符合国家A类标准，重量小于340公斤的应固定于墙壁或地面</td>
               <td class="value"><input class="form-data" name="lSecurity" /></td>
               <td class="name">槽罐阀门及进出口应当加装防盗、防破坏装置</td>
               <td class="value"><input class="form-data" name="bSecurity" /></td>
           </tr>
           <tr>
               <td class="name">检查存在问题
               </td>
               <td class="value" colspan="4">
                   <div style="width: 90%;float:left">
                       <div> <textarea class="form-data" name="trouble" ></textarea></div>
                       <div>
                           <div id="trouble_div" style="margin-top: 20px;">
                           </div>
                       </div>
                   </div>
                   <div style="width: 10%;float:left">
                       <button class="btn btn-primary" onclick="$('#trouble_input').click();">
                           上传文件
                       </button>

                       <input type="file" id="trouble_input" name="file" onchange="uploadFileId('trouble')"
                              value="Upload your resume"
                              style="opacity: 0;width: 0px;display: none">
                   </div>

               </td>

           </tr>
           <tr>
               <td class="name">整改意见
               </td>
               <td class="value" colspan="4">
                   <div style="width: 90%;float:left">
                       <div> <textarea class="form-data" name="suggest"></textarea></div>
                       <div>
                           <div id="suggest_div" style="margin-top: 20px;">
                           </div>
                       </div>
                   </div>
                   <div style="width: 10%;float:left">
                       <button class="btn btn-primary" onclick="$('#suggest_input').click();">
                           上传文件
                       </button>

                       <input type="file" id="suggest_input" name="file" onchange="uploadFileId('suggest')"
                              value="Upload your resume"
                              style="opacity: 0;width: 0px;display: none">
                   </div>

               </td>

           </tr>
           <tr>
               <td class="name">整改完成情况

               </td>
               <td class="value" colspan="4">
                   <div style="width: 90%;float:left">
                       <div> <textarea class="form-data" name="receipt"></textarea></div>
                       <div>
                           <div id="receipt_div" style="margin-top: 20px;">
                           </div>
                       </div>
                   </div>
                   <div style="width: 10%;float:left">
                       <button class="btn btn-primary" onclick="$('#receipt_input').click();">
                           上传文件
                       </button>

                       <input type="file" id="receipt_input" name="file" onchange="uploadFileId('receipt')"
                              value="Upload your resume"
                              style="opacity: 0;width: 0px;display: none">
                   </div>

               </td>

           </tr>
           <tr>

               <td colspan="3" style="padding: 0px !important;">
                   <div class="name"  style="padding-left: 10px;height: 100%;width:30%;float:left">检查人员</div>
                   <div class="value"  style="padding-left: 10px;width:70%;float:left">
                       <input class="form-data" name="checkMan" />
                   </div>
               </td>
               <td colspan="2" style="padding: 0px !important;">
                   <div class="name" style="padding-left: 10px;height: 100%;width:30%;float:left">
                       被检查单位负责人（单位盖章）
                   </div>
                   <div class="value" style="padding-left: 10px;width:70%;float:left">
                       <input class="form-data" name="companyPerson" />
                   </div>
               </td>


           </tr>
       </table>
   </div>
   <div>
       <button type="button" onclick="goBack()" class="btn btn-success">返回</button>
   </div>

</body>
<script type="application/javascript">

    $(function () {
        initData();

    });
    function initData(){
        var data = getData();
        var id = data.id;
        var policeCheckId = data.policeCheckId;
        if(null2empty(id) !==""){
            $("input[name='id']").val(id);
            $.ajax({
                url:"/company/policeCheckTableTwo/find.do",
                data:{'id':id},
                type:'post',
                dataType:'json',
                success:function(data){
                    console.log(data);
                    if(data.success){
                        debugger;
                        initPageDate(data.data, '.form-data');
                        addFileInfoToTable(data.data.troubleFileList,'trouble');
                        addFileInfoToTable(data.data.suggestFileList,'suggest');
                        addFileInfoToTable(data.data.receiptFileList,'receipt');

                    }
                }
            });

        }else if(null2empty(policeCheckId) !==""){
            $("input[name='policeCheckId']").val(id);
        }

    }
    function addFileInfoToTable(fileInfoList,fileType){
        $(fileInfoList).each(function(index,file){
            var fileHtml = "<div  style='border-radius: 2px; width:100%;height:100px;float: left; border: 2px #ffffff solid;'>"+

                "<div align='center' style='height:80px;margin-bottom: 0px;'>"+
                "<div align='center' onclick='downLoadFile(\""+file.path+"\",\""+file.name+"\")' ><input type='hidden' name='"+fileType+"_id' value='"+file.id+"'>"+file.name+"</div>"+

                "<button  style='margin-left: 20px;' " +
                "onclick='downLoadFileId(\""+file.path+"\",\""+file.name+"\")' " +
                "name='download' extendData='"+file.id+"'class='btn btn-primary'>下载</button>"+
                "<div>"
            "</div>";
            $("#"+fileType+"_div").html(fileHtml);

        });
        $("button[name='delete']").unbind('click');
        $("button[name='delete']").click(function(){
            var id = $(this).attr("extendData");
            $.ajax({
                type: "POST",
                url: "/file/delete.do?_t=" + new Date().getTime(),
                data: "fileId=" + id,

                success: function (result) {
                    alert("删除成功");
                },

                error: function (XMLHttpRequest, textStatus, thrownError) {
                    /* alert("系统异常");*/
                }
            });
            $(this).parent().parent().remove();
        });
    }
    function uploadFileId(fileType) {
        $.ajaxFileUpload({
            url: "/file/uploadFile.do?_t=" + new Date().getTime(),            //需要链接到服务器地址
            secureuri: false,//是否启用安全提交，默认为false
            fileElementId: fileType+'_input',                        //文件选择框的id属性
            dataType: 'text',                                     //服务器返回的格式，可以是json, xml
            success: function (data, status) {//服务器成功响应处理函数
                var rpeObj = $.parseJSON(data);
                var fileInfoList = rpeObj.data;
                addFileInfoToTable(fileInfoList,fileType);

            }
        });
    }
    function goBack() {
        goto("police_check_list.html");
    }
</script>
</html>